<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
﻿<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh_CN"
  lang="zh_CN">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link type="text/css" rel="Stylesheet" href="../styles/default.css" />
    <script src="../scripts/?path=boot.js"></script>
    <script>
    $import("org.jside.*",true);
    $import("org.jside.sandbox.stream.*",true);
    </script>
</head>
<body>
<form>
<div  style="float:left;width:60%">
<div id="content">
 <div>路径</div>
 <div><input type="text" name="path"></div>
 <div>内容</div>
 <div><textarea name="content"></textarea></div>
 <hr>
</div>
<div>
 <input type="button" onclick="addRow()" value="添加新内容"/>
 <input type="button" onclick="pack(this.form)" value="生成Zip压缩包"/>
</div>
</div>

<div style="float:right;width=30%">
 <div>文档注释</div>
 <div><textarea name="comment">随便说点什么吧</textarea></div>
 <hr>
</div>
<div style="clear:both"></div>
</form>
  <script>
var content = E("content");
var temp = content.innerHTML;
function addRow(){
    var el = new Element("div");
    el.innerHTML = temp;
    content.parentNode.insertBefore(el,content);
}
function pack(f){
  var zip = new Zip(f.comment.value);
  zip.stringEncoder = stringToGBKByteArray;
  zip.setCompressMethod(zip_deflate);
  var path = f.path;
  var content = f.content;
  if(!content.length){
    path = [path],content = [content ];
  }
  for(var i=0;i<content .length;i++){
    var member = zip.addText(path[i].value,content[i].value);
  }
  var url = zip.toDataURL();
  window.open(url);
}
  </script>
</body>
</html>
